Skip to content

feat(dummies): add ContainingAnyKey to the dictionary generator#289

Merged
Reefact merged 1 commit into
mainfrom
claude/issue-287-containing-any-key
Jul 22, 2026
Merged

feat(dummies): add ContainingAnyKey to the dictionary generator#289
Reefact merged 1 commit into
mainfrom
claude/issue-287-containing-any-key

Conversation

@Reefact

@Reefact Reefact commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

AnyDictionary.ContainingKey(TKey) pins a concrete key, but AnyCollection also offers ContainingAny(IAny<TItem>) to force a generator-drawn value into a collection — and AnyDictionary had no key equivalent. This adds ContainingAnyKey(IAny<TKey>), bringing the dictionary containment surface to full parity with the collection surface.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Analyzer / diagnostic change
  • Tests
  • Documentation
  • Build / CI / tooling

Changes

  • Add AnyDictionary<TKey, TValue>.ContainingAnyKey(IAny<TKey> generator): it null-guards the generator (ArgumentNullException) and routes to the key state's CollectionState.WithContaining(IAny<TKey>, ...) — the same overload AnyCollection.ContainingAny uses — so the drawn key takes one entry's room and inherits the bounded dedup-draw and out-of-domain cardinality credit unchanged. The entry's value is generated like any other.
  • Named ContainingAnyKey rather than a bare ContainingAny for the same reason ContainingKey is not a bare Containing: a dictionary's elements are key/value pairs, so the surface stays explicit about what it constrains.
  • Declare the new member in both per-TFM PublicAPI.Unshipped.txt baselines (netstandard2.0 and net8.0).
  • Add a test that forces a generator-drawn key in (the drawn key lands outside the key generator's own domain) and asserts the null-generator guard.

Testing

  • dotnet build FirstClassErrors.sln — Build succeeded, 0 Warning(s), 0 Error(s) (both the netstandard2.0 and net8.0 legs of Dummies; the PublicAPI analyzer is clean).
  • dotnet test FirstClassErrors.sln — full suite not run locally; ran dotnet test Dummies.UnitTests instead: 451 passed (1 new), 0 failed, 0 skipped.
  • Analyzer tests pass (FirstClassErrors.Analyzers.UnitTests) — not run; no analyzer change in this PR.

Documentation

  • Public API / error documentation updated — the new member is declared in the per-TFM PublicAPI.*.txt baselines.
  • README / doc/ updated
  • French translation (doc/handwritten/for-users/README.fr.md) updated if user-facing behavior changed
  • No documentation change required

Architecture decisions

  • No architectural decision in this pull request — an additive method that reuses the existing collection-containment / cardinality-credit machinery (ADR-0013) unchanged, mirroring AnyCollection.ContainingAny.
  • New decision recorded — ADR drafted as Proposed: ADR-____
  • Supersedes an existing ADR — successor proposed, status not flipped: ADR-____
  • ⚠️ Conflicts with an existing ADR — flagged for the maintainer: ADR-____

Related issues

Closes #287.


Generated by Claude Code

AnyDictionary.ContainingKey(TKey) pins a concrete key, but AnyCollection
also offers ContainingAny(IAny<TItem>) to force a generator-drawn value in,
and the dictionary had no key equivalent — its containment surface was one
method short of the collection surface.

Add ContainingAnyKey(IAny<TKey>) mirroring ContainingAny: it null-guards the
generator and routes to the key state's WithContaining(IAny<TKey>, ...), so
the drawn key takes one entry's room and inherits the bounded dedup-draw and
out-of-domain cardinality credit unchanged. Named ContainingAnyKey rather
than a bare ContainingAny for the same reason ContainingKey is not a bare
Containing: a dictionary's elements are key/value pairs.

Declare it in both per-TFM PublicAPI baselines and cover it with a test —
the draw landing outside the key generator's domain, and the null-generator
guard.

Refs: #287

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RduXUaM3V6tk6MuKxzVzJ
@Reefact
Reefact merged commit 2788f2c into main Jul 22, 2026
16 checks passed
@Reefact
Reefact deleted the claude/issue-287-containing-any-key branch July 22, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dummies: add ContainingAnyKey to AnyDictionary for full containment parity

2 participants